package test.noah.chery.Junit;

import java.util.Iterator;
import java.util.List;

import org.apache.log4j.Logger;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;

import test.noah.chery.dao.CountryCityDao;
import test.noah.chery.entity.City;
import test.noah.chery.mapper.CityMapper;
import test.noah.chery.mapper.CountryMapper;
import test.noah.chery.mapper.CountrylanguageMapper;
import test.noah.chery.service.CountryCityService;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "file:WebRoot/WEB-INF/applicationContext.xml")
@Transactional
public class testCountryCityService {
	public final static Logger log = Logger.getLogger(testCountryCityService.class);
	
	
	@Ignore
	public String[] getConfigLocations() {
	    String[] configLocations = { "file:WebContent/WEB-INF/applicationContext.xml"};
	    return configLocations;
	}
	
	@Autowired
	private CountryMapper countrymapper;
	
	@Autowired
	private CityMapper citymapper;
	
	@Autowired
	private CountrylanguageMapper languagemapper;
	
	
	@Autowired(required=false)
	private CountryCityDao countrycitydao;
	
	@Autowired
	private CountryCityService ccservice;
	
	@Before
	public void setUp() throws Exception{
		System.out.println("Star....................");
	}
	
	@After
	public void after() throws Exception{
		System.out.println("End......................");
	}
	
	@Test
	public void testlist() throws Exception{
		List list = citymapper.selectByCity(new City());
		for(Iterator iter = list.iterator();iter.hasNext();){
			System.out.println(iter.next());
		}
		
		Assert.assertNotNull(list);
	}
	
}
